{% extends 'open-course-manage/layout.html.twig' %}

{% do script(['app/js/course-manage-file/index/index.js']) %}

{% block title %}{{'course.course_files'|trans}} - {{ parent() }}{% endblock %}

{% set side_nav = 'files' %}
{% set tab = 'courseLesson' %}

{% set targetType = 'opencoursematerial' %}
  
{% block page_title %}

  <style type="text/css">
    .tooltip-inner{
      max-width: 600px;
    }
  </style>
  <a class="cd-btn cd-btn-info cd-btn-sm pull-right"
    data-toggle="modal" data-target="#modal"
    data-url="{{path('uploader_batch_upload', {token:uploader_token(targetType, courseSet.id, 'private')}) }}"
  >
    <i class="glyphicon glyphicon-cloud-upload"></i>{{'course.course_files.create_btn'|trans}}
  </a>
  {{'course.course_files.content_title'|trans}}
{% endblock %}

{% block main_body %}
<div id="file-manage-panel" data-file-status-url="{{path('course_set_manage_file_status')}}">
  <table class="table table-striped table-hover" id="course-lesson-table">
    <thead>
      <tr>
        <th width="5%"><input type="checkbox"  data-role="batch-select"></th>
        <th width="30%">{{'course.course_files.name'|trans}}</th>
        <th>{{'course.course_files.type'|trans}}</th>
        <th>{{'course.course_files.size'|trans}}</th>
        <th>{{'course.course_files.use_status'|trans}}</th>
        <th>{{'course.course_files.last_update'|trans}}</th>
        <th>{{'course.course_files.operation'|trans}}</th>
      </tr>
    </thead>
    <tbody>

      {% for uploadFile in files if uploadFile %}
        {% include 'open-course-manage/material-list-tr.html.twig' %}
      {% else %}
        <tr class="empty"><td colspan="20">{{'course.course_files.empty'|trans}}</td></tr>
      {% endfor %}

    </tbody>
  </table>

  <label class="checkbox-inline mrm mbm"><input type="checkbox" data-role="batch-select"> {{'course.course_files.select_all_btn'|trans}}</label>

  <div class="btn-group mbm">
    <button class="cd-btn cd-btn-danger cd-btn-sm" data-role="batch-delete" data-name="{{'course.course_files.record'|trans}}" data-url="{{ path('open_course_manage_delete_materials_show', {id:courseSet.id, type:tab}) }}">
    <i class="glyphicon glyphicon-trash"></i>
    {{'form.btn.remove'|trans}}</button>
  </div>

  <nav class="text-center">
    {{ web_macro.paginator(paginator) }}
  </nav>

</div>
{% endblock %}
